let fixed = document.getElementsByClassName('fixed')[0]
let num = 0
window.onscroll = function(){
    let st = document.documentElement.scrollTop
    let ch = document.documentElement.clientHeight
    if(st > ch){
        (function auto(){
            if(num > -1){
                num -= 0.2
                fixed.style.top = num+'rem'
                return setTimeout(auto, 100);
            }
            fixed.style.top = '-1rem'
        })()
        
    }else{
        num = 0
        fixed.style.top = '0'
    }
}
